import QtQuick

Item {
    id: locationCompensation_Page_1_back
    width: 1760
    height: 935

    property real fontSize: Cpp_Language.CurrentLanguage === 1 ? 40 : Cpp_Language.CurrentLanguage === 2 ? 25 : Cpp_Language.CurrentLanguage === 3 ? 25 : 40
    property real lableFontSize: Cpp_Language.CurrentLanguage === 1 ? 40 : Cpp_Language.CurrentLanguage === 2 ? 25 : Cpp_Language.CurrentLanguage === 3 ? 25 : 50

    A_NumberKeyboard{
        id: locationParameterKeyboard_1
        isDirectOverwrite: false
    }

    Column{         // 左侧列表
        anchors.left: locationCompensation_Page_1_back.left
        anchors.leftMargin: 20
        anchors.top: locationCompensation_Page_1_back.top
        anchors.topMargin: 20

        spacing: 10

        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "250"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_1

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1302,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "500"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_2

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1304,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "750"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_3

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1306,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "1000"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_4

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1308,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "1250"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_5

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1310,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "1500"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_6

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1312,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "1750"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_7

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1314,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "2000"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_8

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1316,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "2250"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_9

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1318,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "2500"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_10

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1320,value)
                }
            }
        }


    }


    Column{         // 右侧列表
        anchors.horizontalCenter: locationCompensation_Page_1_back.horizontalCenter
        anchors.top: locationCompensation_Page_1_back.top
        anchors.topMargin: 20

        spacing: 10

        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "2750"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_11

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1322,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "3000"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_12

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1324,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "3250"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_13

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1326,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "3500"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_14

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1328,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "3750"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_15

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1330,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "4000"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_16

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1332,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "4250"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_17

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1334,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "4500"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_18

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1336,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "4750"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_19

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1338,value)
                }
            }
        }
        Item{
            width: 500
            height: 80

            Rectangle{
                width: 200
                height: 80
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                color: "transparent"

                Text{
                    anchors.centerIn: parent
                    font.pixelSize: fontSize
                    font.bold: true
                    text: "5000"
                }

            }

            A_NumberInput{
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 200
                inputWidth: 300
                inputHeight: 80
                keyboard: locationParameterKeyboard_1
                text: Cpp_PLC.Location_Compensate_20

                onEditingFinished: function(value){
                    Cpp_PLC.write_into_PLC_32_Hold(1340,value)
                }
            }
        }

    }


    Item{
        anchors.right: locationCompensation_Page_1_back.right
        anchors.rightMargin: 20
        anchors.top: locationCompensation_Page_1_back.top
        anchors.topMargin: 20
        width: 560
        height: 440

        // Rectangle{
        //     anchors.fill: parent
        //     border.width: 1
        // }

        Rectangle{
            width: 300
            height: 80
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            // anchors.topMargin: 5
            color: "transparent"

            Text{
                anchors.centerIn: parent
                font.pixelSize: lableFontSize
                font.bold: true
                text: qsTr("摆 角 专 补")
            }

        }

        Column{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 80

            spacing: 10


            Item{
                width: 500
                height: 80

                Rectangle{
                    width: 200
                    height: 80
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    color: "transparent"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: fontSize
                        font.bold: true
                        text: qsTr("位置下限")
                    }

                }

                A_NumberInput{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    inputWidth: 300
                    inputHeight: 80
                    keyboard: locationParameterKeyboard_1
                    text: Cpp_PLC.Swing_Corner_Compensate_Min

                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_PLC_32_Hold(1374,value)
                    }
                }
            }
            Item{
                width: 500
                height: 80

                Rectangle{
                    width: 200
                    height: 80
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    color: "transparent"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: fontSize
                        font.bold: true
                        text: qsTr("位置上限")
                    }

                }

                A_NumberInput{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    inputWidth: 300
                    inputHeight: 80
                    keyboard: locationParameterKeyboard_1
                    text: Cpp_PLC.Swing_Corner_Compensate_Max

                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_PLC_32_Hold(1376,value)
                    }
                }
            }
            Item{
                width: 500
                height: 80

                Rectangle{
                    width: 200
                    height: 80
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    color: "transparent"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: fontSize
                        font.bold: true
                        text: qsTr("补 偿 值")
                    }

                }

                A_NumberInput{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    inputWidth: 300
                    inputHeight: 80
                    keyboard: locationParameterKeyboard_1
                    text: Cpp_PLC.Swing_Corner_Compensate

                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_PLC_32_Hold(1378,value)
                    }
                }
            }
            Item{
                width: 500
                height: 80

                Rectangle{
                    width: 200
                    height: 80
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    color: "transparent"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: fontSize
                        font.bold: true
                        text: qsTr("启用开关")
                    }

                }

                // A_NumberInput{
                //     anchors.verticalCenter: parent.verticalCenter
                //     anchors.left: parent.left
                //     anchors.leftMargin: 200
                //     inputWidth: 300
                //     inputHeight: 80
                //     keyboard: locationParameterKeyboard_1

                //     onEditingFinished: function(value){
                //         console.log(value)
                //     }
                // }

                A_Button{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    buttonWidth: 300
                    buttonHeight: 80
                    contentText_Data: Cpp_PLC.M_421 ? qsTr("已 启 用") : qsTr("未 启 用")
                    isSelected: Cpp_PLC.M_421

                    onButtonClicked: {
                        if(!Cpp_PLC.M_421)
                        {
                           Cpp_PLC.write_into_PLC_Coils(421,true)
                        }
                        else
                        {
                            Cpp_PLC.write_into_PLC_Coils(421,true)
                        }
                    }
                }
            }

        }


    }

    Item{
        anchors.right: locationCompensation_Page_1_back.right
        anchors.rightMargin: 20
        anchors.top: locationCompensation_Page_1_back.top
        anchors.topMargin: 480
        width: 560
        height: 440

        // Rectangle{
        //     anchors.fill: parent
        //     border.width: 1
        // }

        // Rectangle{
        //     width: 300
        //     height: 80
        //     anchors.horizontalCenter: parent.horizontalCenter
        //     anchors.top: parent.top
        //     // anchors.topMargin: 5
        //     color: "transparent"

        //     Text{
        //         anchors.centerIn: parent
        //         font.pixelSize: lableFontSize
        //         font.bold: true
        //         text: qsTr("摆 角 专 补")
        //     }

        // }


        Column{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 10

            spacing: 10


            Item{
                width: 500
                height: 80

                Rectangle{
                    width: 200
                    height: 80
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    color: "transparent"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: fontSize
                        font.bold: true
                        text: qsTr("料长设定")
                    }

                }

                A_NumberInput{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    inputWidth: 300
                    inputHeight: 80
                    keyboard: locationParameterKeyboard_1
                    text: Cpp_PLC.MaterialLength_NormalProcess

                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_PLC_32_Hold(212,value)
                    }
                }
            }

            Item{
                width: 500
                height: 80

                A_Button{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    buttonWidth: 300
                    buttonHeight: 80
                    contentText_Data: qsTr("复  位")

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(5,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(5,false)
                }

            }
            Item{
                width: 500
                height: 80

                A_Button{
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 200
                    buttonWidth: 300
                    buttonHeight: 80
                    contentText_Data: qsTr("定  位")

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(24,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(24,false)
                }

            }

        }

    }

}
